var isCheckAll = 1;
var selectId = null;
var formDom;
var serlizeObj = {};
var paraArr = ['sclx'];
var yinArr = [];
var setArr = [];

//超出隐藏
function tdyc(){
	$('#chajg table tr td .tdjj').removeClass('xxxxx');
	$('#chajg table tr td .tdjj').each(function(){
		if($(this)[0].scrollWidth>$(this).width()+2){
			$(this).addClass("xxxxx");
		}
	});
	//$('.tdjj').removeClass('tdjj');
}
//高亮关键词
function highshow(kw){
	tdyc();
	var ymbhfs=formDom.find('input[name=ymbhfs]').val(),div;
	if(ymbhfs==0){
		div=$('#listform tbody tr td a.a_ym');
	}else if(ymbhfs==1){
		div=$('#listform tbody tr td span.mrjj');
	}else{
		return false;
	}
	if(kw.length > 0 && kw.indexOf('.')==-1){
		kw = getKeywords(kw);
		for (var i in kw){
			div.each(function(num, dl){
				$(dl).html(doHighlight($(dl).html(), kw[i]));
			});
		}
	}
}

//关键词替换
function doHighlight(bodyText, searchTerm, highlightStartTag, highlightEndTag){
	if((!highlightStartTag) || (!highlightEndTag)){
		highlightStartTag = "<span style='color:red;'>";
		highlightEndTag = "</span>";
	}
	var newText = "";
	var i = -1;
	var lcSearchTerm = searchTerm.toLowerCase();
	var lcBodyText = bodyText.toLowerCase();

	while (bodyText.length > 0){
		i = lcBodyText.indexOf(lcSearchTerm, i + 1);
		if(i < 0){
			newText += bodyText;
			bodyText = "";
		} else {
			if(bodyText.lastIndexOf(">", i) >= bodyText.lastIndexOf("<", i)){
				if(lcBodyText.lastIndexOf("/script>", i) >= lcBodyText.lastIndexOf("<script", i)){
					newText += bodyText.substring(0, i) + highlightStartTag + bodyText.substr(i, searchTerm.length) + highlightEndTag;
					bodyText = bodyText.substr(i + searchTerm.length);
					lcBodyText = bodyText.toLowerCase();
					i = -1;
				}
			}
		}
	}
	return newText;
}

//获取过滤后的关键字数组
function getKeywords(str){
	str = str.replace(/[\n|，|\s]/g,',').replace(/[^0-9a-zA-Z\u4e00-\u9fa5\.@_'", \-]/g,'');
	var kw = str.split(',');
	var new_arr=[];
	for(var i=0;i<kw.length;i++){
		if($.inArray(kw[i],new_arr)==-1 && $.trim(kw[i]).length>0){  
			new_arr.push(kw[i]);  
		}
	}
	return new_arr.sort().reverse();
}

//设置表单
function setform(k, v){
	var $val = '',bcz=0;
	k=$.trim(k);
	if(k.indexOf("pr_") != -1 || k.indexOf("bdqz_") != -1){
		var $dom = $(".cha-list ."+k.substr(0, k.indexOf("_"))+" .jm-picker-label");
		var k1 = k.substring(0, k.lastIndexOf('_'));
		if(setArr.indexOf(k1 + "_2")==-1){
			$('#'+k1+' ul li[data-value='+v+']').addClass('active');
			$val="≥"+v;
		}else{
			if(setArr.indexOf(k1 + "_1")>-1){
				$val = setArr.indexOf(k1 + "_1") > setArr.indexOf(k1 + "_2") ? v + "-" + $dom.text() : $dom.text() + "-" + v;
			}
			else{
				$val='≤'+v;
			}
		}
		$val=$val.replace(/(^-*)|(\-*$)/ig, '');
		$dom.text($val).addClass("on").attr("title", $val);
		$(".jm-select-dropdown").find("input[name="+k+"]").val(v);
	} 
	else if(k.indexOf("bdfl_") != -1 || k.indexOf("bdsl_") != -1 || k.indexOf("sgfl_") != -1 || k.indexOf("sgsl_") != -1|| k.indexOf("sosl_") != -1|| k.indexOf("smsl_") != -1|| k.indexOf("wzwl_") != -1 || k.indexOf("zcsj_") != -1 || k.indexOf("dqsj_") != -1){
		var $dom = $(".cha-list ." + k.substr(0, k.indexOf("_"))+" .jm-picker-label");
		var k1 = k.substring(0, k.lastIndexOf('_'));
		var txt = "";
		var dw='';
		if(k.indexOf("zcsj_") != -1 || k.indexOf("dqsj_") != -1){
			dw=k.indexOf("zcsj_") != -1 ? '年' : '天';
		}
		if(setArr.indexOf(k1 + "_2")==-1){
			if(setArr.indexOf(k1 + "_1")>-1){
				if(v=="1"){
					$('#'+k1+' li.cz1').addClass('active');
					txt='存在';
				}else{
					txt='≥'+v+dw;
				}
			}
		}
		else{
			if(setArr.indexOf(k1 + "_1")>-1){
				txt = setArr.indexOf(k1 + "_1") > setArr.indexOf(k1 + "_2") ? v+dw + "-" + $dom.text() : $dom.text() + "-" + v+dw;
			}
			else{
				txt='≤'+v+dw;
			}
		}
		$('#'+k1+' li:contains("'+txt+'")').map(function(){
			if ($(this).text() == txt) { $(this).addClass('active');}
		});
		txt=txt.replace(/(^-*)|(\-*$)/ig, '');
		$dom.text(txt).addClass("on").attr("title",txt);
		$(".jm-select-dropdown input[name="+k+"]").val(v);
	}
	else if(k == 'sfba_1' || k=='jzls'){
		var xz=$('#'+k+' li[data-value='+v+']');
		if(xz.length>0){
			xz.addClass('active');
			$val = $.trim(xz.text());
			$(".cha-list ."+k+" .jm-picker-label").text($val).addClass("on").attr("title", $val);
		}
	}
	else if(k == 'ymhz'){
		v = v.toUpperCase();
		$("#ymhz .updateVal").val("");
		v.split(",").forEach(function (k1, v1){
			$("#ymhz li").each(function (k2, v2){
				if($(v2).attr("data-value") == k1){
					$(v2).addClass("active");
					$val+=k1+'/';
				}
			})
		})
		$val=$val.replace(/(^\/*)|(\/*$)/ig, '');
		$(".cha-list .ymhz .jm-picker-label").text($val).addClass("on").attr("title", $val);
		$("#ymhz .updateVal").val($val);
	} 
	else {
		$("#" + k+" li").each(function (k1, v1){
			if($.trim($(v1).attr('data-value')) == $.trim(v)){
				$val = $.trim($(v1).text());
				$(v1).addClass('active');
			}
		});
		if($val.length>0){
			$(".cha-list ."+k+" .jm-picker-label").text($val).addClass("on").attr("title", $val);
		}else{
			bcz=1;
		}
	}
	//选择,输入框
	var child = $(".cha-list ."+k+"x").children(0);
	var type = child.attr("type");
	if(type != undefined){
		if(type == "text"){
			child.val($.trim(v));
		} else if(type == "checkbox"){
			$(".cha-list ."+k+"x").addClass('jm-checkbox-checked');
			$(".cha-list ."+k+"x").parents('label').addClass('jm-cc');
			child.prop("checked", true);
		} else {
			$(".cha-list ."+k+"x").each(function (k1, v1){
				if($(v1).find("input").val() == v){
					$(v1).addClass("jm-radio-checked");
					if(v == ""){
						$(v1).parents(".jm-radio-group").find(".hidex").addClass("hide");
					} else {
						$(v1).parents(".jm-radio-group").find(".hidex").removeClass("hide");
					}
				}
			});
			child.prop("checked", true);
		}
	}
	if(bcz==0){
		formDom.find("input[name="+k+"]").val(v).removeClass("yin");
	}
}

//根据url加载表单
function loadform(url){
	resetForm();
	var urlObj = GetRequest(url);
	if($.isEmptyObject(urlObj)){
		return false;
	}
	setArr = Object.keys(urlObj);
	$.each(urlObj, function (k, v){
		if(v != '' && v != undefined && k!='tao'){
			setform(k, v);
		}
	});
	//自动展开
	var $dom = $(".slide-down span");
	if(!$dom.hasClass("on")){
		var a = ['wxjc','qqjc','bdjc','qiangjc','jzls','jznl_1','jznl_2','jzyy','jzjl_1','jzjl_2','sfba_1','baxz','bajrs','bdrz','bdpj','bdsl_1','bdsl_2','sgsl_1','sgsl_2','sosl_1','sosl_2','smsl_1','smsl_2','bdqz_1','bdqz_2','pr_1','pr_2','bdfl_1','bdfl_2','sgfl_1','sgfl_2','wzwl_1','wzwl_2','jgpx'];
		if(a.filter(function(v){ return setArr.indexOf(v) > -1 }).length>0){
			$dom.addClass('on').html("收起高级搜索<i class='iconfont'>&#xe76e;</i>");
			$(".cha-list-show").show();
			$(".cha-bottom").addClass("x-opacity");
		}
	}

	var jzjlStr = "";
	if(urlObj['sfba_1'] != undefined){
		jzjlStr=$('#sfba_1 li.active').text();
		if(urlObj['sfba_1']=="1"||urlObj['sfba_1']=="2"){
			var baxz=$('#baxz li.active');
			if(baxz.length>0){
				jzjlStr+='-'+baxz.text();
			}
		}
		if(urlObj['sfba_1']=="1"){
			var jrs=$('#bajrs li.active');
			if(jrs.length>0){
				jzjlStr+='-'+jrs.text();
			}
		}
		jzjlStr.length>0 && $(".cha-list .sfba_1 .jm-picker-label").text(jzjlStr).addClass("on").attr("title", jzjlStr);
	}
	var jzlsStr = '';
	if(urlObj['jzls']=="1"){
		if(urlObj['jznl_1'] != undefined && urlObj['jznl_2'] != undefined){
			jzlsStr += urlObj['jznl_1'] + '-' + urlObj['jznl_2'] + '年/';
		}else if(urlObj['jznl_1'] != undefined && urlObj['jznl_2'] == undefined){
			jzlsStr += "≥" + urlObj['jznl_1'] + '年/';
		}else if(urlObj['jznl_1'] == undefined && urlObj['jznl_2'] != undefined){
			jzlsStr += "≤" + urlObj['jznl_2'] + '年/';
		}
		if(urlObj['jzyy'] != undefined){
			var yy=$('#jzyy li.active');
			if(yy.length>0){
				jzlsStr+=yy.text()+'/';
			}
		}
		if(urlObj['jzjl_1'] != undefined && urlObj['jzjl_2'] != undefined){
			jzlsStr += urlObj['jzjl_1'] + '-' + urlObj['jzjl_2'] + '记录/';
		}else if(urlObj['jzjl_1'] != undefined && urlObj['jzjl_2'] == undefined){
			jzlsStr += "≥" + urlObj['jzjl_1'] + '记录/';
		}else if(urlObj['jzjl_1'] == undefined && urlObj['jzjl_2'] != undefined){
			jzlsStr += "≤" + urlObj['jzjl_2'] + '记录/';
		}
		if(jzlsStr){
			jzlsStr=jzlsStr.substring(0, jzlsStr.lastIndexOf('/'));
			$(".cha-list").find(".jzls .jm-picker-label").text(jzlsStr).addClass("on").attr("title", jzlsStr);
		}
	}
	
}

//重置搜索
function morenshezhi(){
	resetForm();
	cha();
	return false;
}

//重置表单
function resetForm(){
	$(".cha-list .jm-checkbox").removeClass('jm-checkbox-checked').find('input').prop("checked", false);
	$(".cha-list input[class*=jm-input]").val('').attr("data-value", '');
	$(".cha-list .jm-radio").removeClass('jm-radio-checked').prop("checked", false)
	$(".cha-list .jm-picker-label,.jm-select-dropdown .jm-picker-label").text('').removeClass("on").attr("title", '');
	$("textarea[name='gjz_cha']").val('')
	$(".jm-radio-group .hidex").addClass("hide");
	$(".jm-select-dropdown .jm-input").val('');
	$(".jm-select-dropdown li").removeClass("active");
	$(".jm-checkbox-wrapper").removeClass("jm-cc");
	$(".bx").removeClass('active1');
	yinArr.forEach(function (k, v){
		formDom.find("input[name="+k+"]").addClass('yin');
	})
	$("#cha-form")[0].reset();
}

//获取url参数
function GetRequest(urlx){
	var url = location.search;
	if(urlx != "1" || urlx == "?"){
		url = urlx;
	}
	if(typeof url==="undefined"){
		return false;
	}
	url=decodeURIComponent(url);
	var re = new Object();
	if(url.indexOf("?") != -1){
		var str = url.substr(1);
		if(str!=""){
			strs = str.split("&");
			for (var i = 0; i < strs.length; i++){
				var x = strs[i].split("=");
				var k = x[0];
				var v = unescape(x[1]);
				re[k] = v;
			}
		}
	}
	return re;
}

//生成分页
function LoadPage(page,pagesize,count){
	var totalpage=Math.ceil(count/pagesize);
	var html = '<strong class="pagenow">'+pagesize+'条/页，第'+page+'/'+totalpage+'页，</strong><strong class="count">共'+count+'条记录</strong>';
	if(page == 1){
		html += '<span class="indexpage disabled">首页</span><span class="prepage disabled">上一页</span>';
	}else {
		html += '<a class="indexpage" onclick="return onPage(1);">首页</a><a class="prepage" onclick="return onPage(' + (page - 1) + ');">上一页</a>';
	}
	if(totalpage<=page){
		html += '<span class="nextpage disabled">下一页</span><span class="lastpage disabled">尾页</span>';
	}else{
		html += '<a class="nextpage" onclick="return onPage(' + (page + 1) + ');">下一页</a><a class="lastpage" onclick="return onPage(' + totalpage + ');">尾页</a>';
	}
	html+='<span class="tiaozhuangzhi">跳转至：</span><span class="jm-picker1" tabindex="0"><input tabindex="-1" placeholder="" class="jm-input" type="text" id="ToPage" value="'+page+'"></span><button type="button" class="jm-button go" onclick="return onPage(document.getElementById(\'ToPage\').value);">GO</button>';
	return html;
}

//翻页
function onPage(page){
	if(page>1){
		if(!islogin()){
			return false;
		}
		if(page>5 && !isvip("只能查看前5页")){
			return false;
		}
	}
	$("html,body").animate({scrollTop:$(".cha-wrap").offset().top - "60" + "px"}, 300);
	$('#page').val(page);
	cha();
	$('#page').val('1');
	return false;
}

//每页数量
function pagesize(a){
	if(a<1){
		layer.alert('最小为1条!');
		$('#pageset').val('');
		return false;
	}
	else if(a>50){
		if(!islogin()){return false;}
		if(a>1000){
			layer.alert('最大不能超过1000条!');
			$('#pageset').val('');
			return false;
		}
	}
	$('.psize').val(a);
	cha();
}

//鼠标移出更新列表
function updateCha(){
	$(".updateList").each(function (k, v){
		var $id = $(v).attr("id");
		var $val = $(v).find(".updateVal").val().toUpperCase();
		$val && $(".cha-list").find("." + $id).find('.jm-picker-label').text($val).addClass("on").attr("title", $val);
		formDom.find("input[name=" + $id + "]").val($val);
		if($id == "ymhz"){
			formDom.find("input[name=ymhz]").val($val.toLowerCase().replace(/\//ig, ","));
		}
		if($id == "sclx"){
			var arr = [];
			if($("#sclx li.active").length > 0){
				$("#sclx li.active").each(function (k, v){
					arr.push($(v).attr("data-value"));
				})
				formDom.find("input[name=sclx]").val(arr).removeClass("yin");
			}
		}
	})
}

//执行查询
function cha(fs){
	//1获取请求参数
	serlizeObj = {};
	$(".cha-list input[type='checkbox']").each(function (k, v){
		if($(v).is(":checked")){
			formDom.find("input[name=" + $(v).attr('name') + "]").val($(v).val()).removeClass('yin');
		} else {
			formDom.find("input[name=" + $(v).attr('name') + "]").addClass('yin');
		}
	})
	$(".cha-list input[type='radio']").each(function (k, v){
		if($(v).parent(".jm-radio").hasClass("jm-radio-checked")){
			if($(v).val() != ""){
				formDom.find("input[name=" + $(v).attr('name') + "]").val($(v).val()).removeClass('yin');
			} else {
				formDom.find("input[name=" + $(v).attr('name') + "]").val('').addClass('yin');
			}
		}
	})
	$(".cha-list .jm-input-normal").each(function (k, v){
		formDom.find("input[name=" + $(v).attr('name') + "]").val($(v).val())
	})
	$(".cha-list textarea").each(function (k, v){
		formDom.find("input[name=" + $(v).attr('name') + "]").val($(v).val().split('\n'))
	})
	formDom.find('input').each(function (k, v){
		if(!$(v).hasClass('yin') && $(v).val() != "" && $(v).val() != undefined){
			serlizeObj[$(v).attr('name')] = $(v).val();
			if($.inArray($(v).attr('name'), paraArr) != -1){
				serlizeObj[$(v).attr('name')] = $(v).val();
			}
		}
	})
	
	//$("#test").attr("data-href", $.param(serlizeObj) != '' ? "?" + $.param(serlizeObj) : '');
	//console.log($.param(serlizeObj));
	//console.log(serlizeObj);

	if(fs==1){
		return false;
	}
	
	//2预判断
	var psize=formDom.find("input[name=psize]").val();
	if(psize>50 && !isvip("无法设置查询结果<font color=red>每页显示"+psize+"条</font>")){
		return false;
	}
	//3执行搜索
	layer.load(3,{shade:0.3,anim:-1});
	//return false;
	$.ajax({
		type: 'POST',
		url: '/ykj/get_list',
		data: serlizeObj,
		cache: false,
		timeout: 120000,
		dataType: "json",
		error: function (request){
			layer.closeAll();
			layer.alert('加载超时，请重试一次，如重试不行，请联系本站客服！',layset);
		},
		success: function (data){
			layer.closeAll();
			cha_call(data);
		}
	});
	isCheckAll=1;
	return false		
}

//查询回调
function cha_call(d){
	var dom=$('#chajg');
	if(d.code<0){
		dom.html("<div class='err_tips'>"+d.msg+"</div>");
	}
	else{
		dom.html(d.html);
		highshow($.trim($('#cha-form .gjz_cha').val()) + ',' + $.trim($('#cha-form .gjz_chab').val()));
		fav_zt();
	}
	return false;
}

//复制
function copytxt(txt) {
	var copyt = $('<input id="copy" type="text" value="'+txt+'" />');
	$('body').append(copyt);
    $('#copy').select();
    document.execCommand("Copy");
    $('#copy').remove();
}

//分享链接
function share(){
	cha(1);
	var data=serlizeObj;
	delete data.page;
	if($.isEmptyObject(data)){
		layer.alert('请先设置查询参数!');
		return false;
	}
	var url=window.location.origin+'/ykj/?'+$.param(data);
	if(data.tao>0){
		url=window.location.origin+'/'+data.tao+'/?';
		delete data.tao;
		url+=$.param(data);
	}
	
	if(uid<=0){
		login();
		//copytxt(url);
		//layer.alert('复制网址成功：<br><span class="share_link">'+url+'</span><br>快将链接分享给您的朋友吧！',{icon: 1,area:'500px',title:'提示',skin: 'jm-class'});
		return false;
	}
	$.ajax({
		type: "post",
		url: '/ykj/share',
		timeout: 3000,
		cache: false,
		async:false,
		data: {url:url},
		success: function(d) {
			if (d.code==1) {
				url=window.location.origin+'/t/'+d.url;
				copytxt(url);
				layer.alert('生成分享地址并复制成功：<br><span class="share_link">'+url+'</span><br>快将链接分享给您的朋友吧！',{icon: 1,area:'500px',title:'提示',skin: 'jm-class'});
			}
			else{
				layer.alert("<font color=red>"+d.msg+"</font>",layset);
			}
			
		}
	});
	return false;
}

//新增自定义查询
function diy_add(){
	if(!islogin()){return false;}
	layer.prompt({title: '请输入保存名称'}, function(value, index, elem){
		if(value.length>30){
			layer.msg('名称不请勿大于30字符!');
			return false;
		}
		cha(1);
		var data=serlizeObj;
		data.diyname=value;
		delete data.page;
		$.ajax({
			type: "post",
			url: '/ykj/diy_add',
			timeout: 3000,
			cache: false,
			data: data,
			datatype: "json",
			success: function(d) {
				if (d.code==1) {
					layer.close(index);
					layer.msg(d.msg);
					diy_get();
				}
				else{
					layer.alert("<font color=red>"+d.msg+"</font>",layset);
				}
			}
		});
	});
	return false;
}

//加载自定义搜索
function diy_get(){
	if(uid>0){
		$.ajax({
			type: "get",
			url: '/ykj/diy_get',
			timeout: 3000,
			cache: false,
			success: function(d) {
				if (d.code==1) {
					$('#diylist .num').html(d.count);
					if(d.count>0){
						var h='';
						$.each(d.data,function(k,v){
							h+='<li id="diy'+v.id+'"><a href="javascript:void(0)" data-href="?'+v.nr+'">'+v.mc+'</a><a onclick="return diy_del('+v.id+')" class="diy_del"><i class="iconfont">&#xe644;</i></a></li>';
					});
						$('.diydiv').removeClass('empty');
						$('.diylist_ul').html(h);
					}
				}
			}
		});
	}
	else{
		$('#diylist .num').html('0');
		$('.diydiv').addClass('empty');
		$('.diylist_ul').html('');
	}
	return false;
}

function diy_del(id){
	if(id>0){
		$.ajax({
			type: "post",
			url: '/ykj/diy_del',
			data:'id='+id,
			timeout: 3000,
			cache: false,
			success: function(d) {
				layer.msg(d.msg);
				if(d.code==1) {
					$('#diy'+id).remove();
					var num=parseInt($('#diylist .num').html())-1;
					$('#diylist .num').html(num);
					if(num<=0){
						$('.diylist_ul').addClass('empty');
					}
				}
			}
		});
	}
	return false;	
}

//结果排序
function jgpx(px){
	var pxx=px%2;
	if(pxx==0 && $("#jgpx li[data-value='"+px+"']").length==0){
		var text=$("#jgpx li[data-value='"+(px-1)+"']").text();
		$("#jgpx ul").append('<li role="option" class="jm-select-dropdown-menu-item" data-value="'+px+'">'+text+'↑</li>');
	}
	formDom.find('input[name=jgpx]').val(px);
	$("#jgpx ul li").removeClass('active');
	var t=$("#jgpx li[data-value='"+px+"']");
	t.addClass('active');
	$('.cha-list .jgpx .jm-picker-label').text(t.text()).addClass('on').attr('title',t.text());
	cha();
}

//查询关注状态
function fav_zt(){
	return false;
	if(uid<=0){
		return false;
	}
	//获取域名id
	var favdom=$("#listform tbody tr").find("td:first input:checkbox[name='id[]']"),
		fav=[];
	
	if(favdom.length>0){
		favdom.each(function(){ 
			fav.push($(this).val()); 
		});
	}
	//执行查询
	if(fav.length>0){
		$.ajax({
			type: "post",
			url: '/ykj/cha_gz',
			timeout: 5000,
			cache: false,
			data: 'fav='+fav.join(','),
			datatype: "json",
			success: function(d){
				if(d.code==1){
					if(d.fav.length>0){
						for (var i in d.fav){
							$("#shou_"+d.fav[i]).html("<a href='/user_shop_mai_gz_list.htm' target='_blank' title='查看我关注的域名'><span class='disableds'>已关注</span></a>");
						}
					}
				}
			}
		});
	}
	
	return false;
}

//关注域名
function add_gz(id,ymid){
	if(!islogin()){return false;}
	$('#'+id).html("<img src='http://img.chaicp.com/img/lo.gif'>");
	$.ajax({
		type: "get",
		cache:false,
		url: "/ykj/add_gz?id="+ymid,
		timeout: 60000,
		error:function(){$('#'+id).html('操作失败');},
		success:function(re){
			if(re.code==1){
				$('#'+id).html("<a href='/user_shop_mai_gz_list.htm' target='_blank' title='查看我关注的域名'><span class='disableds'>已关注</span></a>");
			}
			else{
				$('#'+id).html("<font color=red title='"+re.msg+"'>失败</font>");
			}
		}
	});
	return false;
}

//微信检测
function wxjc(ymid){
	if(!islogin()){return false;}
	var div=$('#wxjc_'+ymid);
	div.html("<img src='http://img.chaicp.com/img/lo.gif'>");
	$.ajax({
		type: "get",
		cache:false,
		url: "/ykj/cha?do=weixin&id="+ymid,
		timeout: 60000,
		error:function(){div.html('<font color=red title="请求失败">失败</font>');},
		success:function(re){
			if(re.code==1){
				div.html(re.msg);
			}
			else{
				div.html("<font color=red title='"+re.msg+"'>失败</font>");
			}
		}
	});
	return false;
}


//批量关注
var piliang_cl_ks=0;
function piliang_cl(cla){
	if(!islogin()){return false;}
	layer.confirm('确定执行批量操作吗？',function(index){
		var t0=0;
		$("a[class^='"+cla+"']").each(function(i){
			t0=t0+1;
			piliang_cl_ks=1;
			$(this).click();
		});
		piliang_cl_ks=0;
		layer.close(index);
		layer.msg("执行完成!");
		return false;
	});
}

//批量操作
function plcz(fs){
	var check=$("#listform tbody tr td input:checked");
	if (check.length < 1) {
		layer.alert("未选中任何域名！",layset);
	}
	else{
		if(fs==1){
			var ym=[];
			check.each(function(){ 
				ym.push($(this).parents('label').next('a.a_ym').text()); 
			});
			daochu(ym.join("<br>"));
			return false;
		}else if(fs==0){
			if(!islogin()){return false;}
			$("#listform").submit();
		}
	}
	return false;
}

//下载查询列表
function downlist(){
	if(!islogin() || !isvip()){return false;}
	if(Object.keys(serlizeObj).length==0){cha(1);}
	var data=serlizeObj;
	delete data.page;
	var form = $('<form class="hide" target="_blank" action="/ykj/down" method="post"></form>');
	$.each(data,function (k,v){
		form.append('<input name="'+k+'" type="hidden" value="'+v+'" />');
	});
	$(document.body).append(form);
	form.submit().remove();
}

//替换.为_
function t_gym2(ym){
	return ym.replace(/\./g,"_").toLowerCase();
}

function dl_call(){
	var c=GetRequest(1);
	if(c.zt==1){
		$('.cjsjd').removeClass('hide');
		$('.gzsxdiv').addClass('hide');
	}
	else{
		$('.gzsxdiv').removeClass('hide');
		$('.cjsjd').addClass('hide');
	}
	diy_get();
}
function tc_call(){
	$('.gzsxdiv,.cjsjd').addClass('hide');diy_get();
}

//收藏店铺
function scdp(id){
	if(!islogin()){return false;}
	$.ajax({
		type: "get",
		cache:false,
		url: "/ykj/dianpu_sc?id="+id,
		timeout: 60000,
		error:function(){
			layer.alert('请求失败!');
		},
		success:function(re){
			if(re.code==1){
				$('#sc_dpsc').html("<i class='iconfont'>&#xe645;</i>店铺已收藏").attr('href',"/user_shop_mai_scdp_list.htm");
			}
			else{
				layer.alert(re.msg);
			}
		}
	});
	return false;
}

$(function (){
	formDom = $("#cha-form");
	var ymcd={"不限":""," 1":1," 2":2," 3":3," 4":4," 5":5," 6":6," 7":7," 8":8," 9":9," 10":10," 11":11," 12":12," 13":13," 14":14," 15":15," 16":16," 17":17," 18":18," 19":19," 20":20," 21":21," 22":22," 23":23," 24":24," 25":25," 26":26," 27":27," 28":28," 29":29," 30":30," 31":31," 32":32," 33":33," 34":34," 35":35," 36":36," 37":37," 38":38," 39":39," 40":40};
	
	//表单处理
	//查询字段参数值 lx 1=普通下拉  2=单选型(收录/反链/权重) 3=多选型(后缀/类型)
	var sel={
		"ymbhfs":{"lx":1,"width":85,"data":{"域名包含":"0","介绍包含":"1","店铺ID":"2"}},//包含方式
		"ympcfs":{"lx":1,"width":85,"data":{"域名排除":"0","介绍排除":"1","排除店铺ID":"2"}},//排除方式
		"wxjc":{"lx":1,"data":{"不限":"","未拦截":"1","已拦截":"2","确认访问":"3","复制访问":"4","还未检测":"99"}},//微信检测
		"qqjc":{"lx":1,"data":{"不限":"","未拦截":"1","绿色认证":"11","已拦截":"2","还未检测":"99"}},//QQ检测
		"bdjc":{"lx":1,"data":{"不限":"","正常":"1","安全":"2","危险":"3","还未检测":"99"}},//百度检测
		"qiangjc":{"lx":1,"data":{"不限":"","正常":"1","被墙":"3","污染":"2","还未检测":"99"}},//被墙检测
		"bdrz":{"lx":1,"data":{"不限":"","已认证":"1","未认证":"2"}},//百度认证
		"bdpj":{"lx":1,"data":{"&nbsp;不限":"","存在":"1","不存在":"2"}},//百度评价
		"ymcd_1":{"lx":1,"width":80,"data":ymcd},//长度1
		"ymcd_2":{"lx":1,"width":80,"data":ymcd},//长度2
		"cjsj":{"lx":1,"width":185,"data":{"今天":"1","昨天":"2","前天":"3","7天内":"4","15天内":"5","30天内":"6","本月":"7","上月":"8"}},
		"ymgc":{"lx":1,"width":185,"data":{"不限":0,"纯数字":1,"&nbsp;&nbsp;&nbsp;&nbsp;三数字":11,"&nbsp;&nbsp;&nbsp;&nbsp;四数字":12,"&nbsp;&nbsp;&nbsp;&nbsp;五数字":13,"&nbsp;&nbsp;&nbsp;&nbsp;六数字":14,"&nbsp;&nbsp;&nbsp;&nbsp;七数字":15,"&nbsp;&nbsp;&nbsp;&nbsp;八数字":16,"&nbsp;&nbsp;&nbsp;&nbsp;九数字":17,"纯字母":2,"&nbsp;&nbsp;全声母":5,"&nbsp;&nbsp;&nbsp;&nbsp;三声母":51,"&nbsp;&nbsp;&nbsp;&nbsp;四声母":52,"&nbsp;&nbsp;&nbsp;&nbsp;五声母":53,"&nbsp;&nbsp;三字母":55,"&nbsp;&nbsp;四字母":56,"&nbsp;&nbsp;&nbsp;&nbsp;CVCV":57,"&nbsp;&nbsp;拼音域名":6,"&nbsp;&nbsp;&nbsp;&nbsp;单拼":7,"&nbsp;&nbsp;&nbsp;&nbsp;双拼":8,"&nbsp;&nbsp;&nbsp;&nbsp;三拼":9,"&nbsp;&nbsp;&nbsp;&nbsp;四拼":10,"&nbsp;&nbsp;&nbsp;&nbsp;单拼与双拼":112,"&nbsp;&nbsp;&nbsp;&nbsp;双拼与三拼":111,"数字+字母":4,"&nbsp;&nbsp;&nbsp;&nbsp;二杂":42,"&nbsp;&nbsp;&nbsp;&nbsp;三杂":43,"&nbsp;&nbsp;&nbsp;&nbsp;四杂":44,"&nbsp;&nbsp;&nbsp;&nbsp;五杂":45,"排除“-”中线":3,"排除数字":58}},
		"ymgcte":{"lx":1,"width":185,"data":{"特别构成/请选择":"","==3位==":"","&nbsp;&nbsp;&nbsp;&nbsp;AAA":"1,1,1","&nbsp;&nbsp;&nbsp;&nbsp;AAB":"1,1,2","&nbsp;&nbsp;&nbsp;&nbsp;ABB":"1,2,2","&nbsp;&nbsp;&nbsp;&nbsp;ABA":"1,2,1","&nbsp;&nbsp;&nbsp;&nbsp;NNL":"NNL","&nbsp;&nbsp;&nbsp;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":"1,1,2,2,2,3","&nbsp;&nbsp;&nbsp;&nbsp;ABBCCC":"1,2,2,3,3,3","&nbsp;&nbsp;&nbsp;&nbsp;AABBCC":"1,1,2,2,3,3","&nbsp;&nbsp;&nbsp;&nbsp;ABCCBA":"1,2,3,3,2,1","&nbsp;&nbsp;&nbsp;&nbsp;ABCABC":"1,2,3,1,2,3","&nbsp;&nbsp;&nbsp;&nbsp;ABBCBB":"1,2,2,3,2,2","&nbsp;&nbsp;&nbsp;&nbsp;AABCCB":"1,1,2,3,3,2","&nbsp;&nbsp;&nbsp;&nbsp;AABAAC":"1,1,2,1,1,3","&nbsp;&nbsp;&nbsp;&nbsp;ABBACC":"1,2,2,1,3,3","&nbsp;&nbsp;&nbsp;&nbsp;ABCABD":"1,2,3,1,2,4","&nbsp;&nbsp;&nbsp;&nbsp;ABCADC":"1,2,3,1,4,3","&nbsp;&nbsp;&nbsp;&nbsp;NLLLLL":"NLLLLL","&nbsp;&nbsp;&nbsp;&nbsp;NNLLLL":"NNLLLL","&nbsp;&nbsp;&nbsp;&nbsp;NNNLLL":"NNNLLL","&nbsp;&nbsp;&nbsp;&nbsp;NNNNLL":"NNNNLL","&nbsp;&nbsp;&nbsp;&nbsp;NNNNNL":"NNNNNL","&nbsp;&nbsp;&nbsp;&nbsp;LNNNNN":"LNNNNN","&nbsp;&nbsp;&nbsp;&nbsp;LLNNNN":"LLNNNN","&nbsp;&nbsp;&nbsp;&nbsp;LLLNNN":"LLLNNN","&nbsp;&nbsp;&nbsp;&nbsp;LLLLNN":"LLLLNN","&nbsp;&nbsp;&nbsp;&nbsp;LLLLLN":"LLLLLN"}},
		"bdsl":{"lx":2,"width":318,"data":"sl"},//百度收录
		"sgsl":{"lx":2,"width":318,"data":"sl"},//搜狗收录
		"sosl":{"lx":2,"width":318,"data":"sl"},//360收录
		"smsl":{"lx":2,"width":318,"data":"sl"},//神马收录
		"bdfl":{"lx":2,"width":318,"data":"fl"},//百度反链
		"sgfl":{"lx":2,"width":318,"data":"fl"},//搜狗反链
		"wzwl":{"lx":2,"width":318,"data":"fl"},//网站反链
		"bdqz":{"lx":2,"width":318,"data":"pr"},//百度权重
		"pr":{"lx":2,"width":318,"data":"pr"},//搜狗pr
		"zcsj":{"lx":2,"width":318,"data":"zcsj"},//注册时间
		"dqsj":{"lx":2,"width":318,"data":"dqsj"},//注册时间
		"ymhz":{"lx":3,"width":464,"data":{".COM":".COM",".NET":".NET",".CN":".CN",".COM.CN":".COM.CN",".ORG":".ORG",".TOP":".TOP",".VIP":".VIP",".CC":".CC",".TV":".TV","国际":"国际","国内":"国内","排除省级":"排除省级"}},//域名后缀
		"sfba_1":{"lx":1,"data":{"不限":"","历史存在":"2","不存在":"99"}},//建站记录
		"jzls":{"lx":1,"data":{"不限":"","存在":"1","不存在":"99"}},//建站历史
		"jgpx":{"lx":1,"width":150,"data":{"默认":"0","域名价格":"3","浏览热门":"35","上架时间":"5","今日上架":"41","注册时间":"7","到期时间":"37","域名长度":"1","域名排序":"19","百度权重":"11","百度收录":"13","百度反链":"27","搜狗PR":"9","搜狗收录":"25","搜狗反链":"15","网站外链":"21","域名估价":"17","建站历史记录数":"23","建站历史年龄":"29","360收录":"31","神马收录":"33","终端数量":"39"}},//结果排序
		"ymjj":{"lx":1,"width":80,"data":{"域名简介":"1","卖家介绍":"2"}},//域名简介
		"gzsx":{"lx":1,"width":185,"data":{"不限":"","只查我关注的店铺":"1","排除我关注的店铺":"2","只查我关注的域名":"3","排除我关注的域名":"4"}}
	};//
	if(typeof(dpfz)=="object" && dpfz['lx']==1){
		sel['zu']=dpfz;
	}
	var ahtml='';
	$.each(sel,function (k,v){
		var width= v.width && v.width>0 ? ' style="width:'+v.width+'px;"' : '';
		//普通
		if(v.lx==1){
			ahtml+='<div class="p-box nocopy" id="'+k+'" data-name="'+k+'"><div class="jm-select-dropdown jm-select-dropdown-hidden"'+width+'><ul role="listbox" class="jm-select-dropdown-menu list1" tabindex="0">';
			$.each(v.data,function(kk,vv){
				ahtml+='<li role="option" class="jm-select-dropdown-menu-item" data-value="'+vv+'">'+kk+'</li>';
			});
			ahtml+='</ul></div></div>';
		}
		//单选
		else if(v.lx==2){
			ahtml+='<div class="slfl p-box nocopy" id="'+k+'" data-name="'+k+'"><div class="jm-select-dropdown jm-select-dropdown-list jm-select-dropdown-hidden"'+width+'><ul role="listbox" class="jm-select-dropdown-menu nth4" tabindex="0">';
			if(v.data=='sl' || v.data=='fl'){
				ahtml+='<li class="bx1">不限</li><li class="cz1">存在</li><li>≥5</li><li>≥10</li><li>≥50</li><li>≥100</li><li>≥500</li><li>≥1000</li>';
			}
			else if(v.data=='pr'){
				ahtml+='<li class="bx1" data-value="">不限</li><li data-value="1">≥1</li><li data-value="2">≥2</li><li data-value="3">≥3</li><li data-value="4">≥4</li><li data-value="5">≥5</li><li data-value="6">≥6</li><li data-value="7">≥7</li><li data-value="8">≥8</li><li data-value="9">≥9</li>';
			}
			else if(v.data=='zcsj'){
				ahtml+='<li class="bx1" data-value="">不限</li><li data-value="2018">≤2018年</li><li data-value="2017">≤2017年</li><li data-value="2016">≤2016年</li><li data-value="2015">≤2015年</li><li data-value="2014">≤2014年</li><li data-value="2013">≤2013年</li><li data-value="2012">≤2012年</li><li data-value="2011">≤2011年</li><li data-value="2010">≤2010年</li><li data-value="2009">≤2009年</li><li data-value="2008">≤2008年</li>';
			}
			else if(v.data=='dqsj'){
				ahtml+='<li class="bx1" data-value="">不限</li><li data-value="1">≥1天</li><li data-value="7">≥7天</li><li data-value="30">≥30天</li><li data-value="60">≥60天</li><li data-value="90">≥90天</li><li data-value="120">≥120天</li><li data-value="180">≥180天</li><li data-value="240">≥240天</li><li data-value="300">≥300天</li><li data-value="355">≥355天</li><li data-value="600">≥600天</li>';
			}
			ahtml+='</ul><div class="slfl-zdy">自定义<span class="zdy-input"><input class="jm-input integer integer1" name="'+k+'_1" type="text" placeholder="不限"><span>-</span><input class="jm-input integer" name="'+k+'_2" type="text" placeholder="不限"><button class="jm-button" type="button">确定</button></span></div></div></div>';
		}
		//多选
		else if(v.lx==3){
			ahtml+='<div id="'+k+'" class="updateList p-box nocopy" data-name="'+k+'"><div class="jm-select-dropdown jm-select-dropdown-list '+k+' jm-select-dropdown-hidden"'+width+'><ul role="listbox" class="jm-select-dropdown-menu nth6" tabindex="0">';
			$.each(v.data,function(kk,vv){
				ahtml+='<li data-value="'+vv+'">'+kk+'</li>';
			});
			var input='<input class="jm-input updateVal" type="text" placeholder="可用“/”分隔">';
			ahtml+='</ul><button type="button" class="bx">不限</button><span class="zdy-input fr">'+input+'<button class="jm-button submit-hz" type="button">确定</button></span></div></div>';
		}
	})
	$('body').append(ahtml);

	//获取隐藏表单元素
	formDom.find("input").each(function (k, v){
		if($(v).hasClass("yin")){
			yinArr.push($(v).attr("name"));
		}
	})

	loadform(surl);
	highshow($.trim($('#cha-form .gjz_cha').val()) + ',' + $.trim($('#cha-form .gjz_chab').val()));
	if(uid>0){
		fav_zt();diy_get();
	}

	//开始查询
	$("#cha").click(function (){
		cha();
	});

	//自定义搜索
	$('body').on('click','.s_zdy li a',function(){
		var url=$(this).attr("data-href");
		if(url){
			loadform(url);
			cha();
		}
		return false;
	});
	
	//展开合起
	$(".cha-more").click(function (event){
		var $parents = $(this).parents(".quick-wrap");
		if($parents.next(".quick-cha-more").hasClass('hide')){
			$parents.find(".cha-more").text("-");
		} else {
			$parents.find(".cha-more").text("+");
		}
		$parents.next(".quick-cha-more").toggleClass('hide');
	});

	//高级搜索
	$(".slide-down span").click(function (event){
		var $dom = $(this);
		if($dom.hasClass('on')){
			$dom.html("展开高级搜索<i class='iconfont'>&#xe772;</i>");
		} else {
			$dom.html("收起高级搜索<i class='iconfont'>&#xe76e;</i>");
		}
		$dom.toggleClass('on');
		$(".cha-bottom").toggleClass("x-opacity");
		$(".cha-list-show").slideToggle(400);
	});

	$(".cha-s .jm-radio-wrapper").click(function (event){
		$(".cha-s .jm-radio-wrapper").removeClass('jm-cc');
		var val = $(this).find(".jm-radio-input").val();
		$(this).parents(".jm-radio-group").find('.jm-radio').removeClass('jm-radio-checked');
		$(this).parents(".jm-radio-group").find('input').prop("checked", false);
		if(val == ""){
			$(this).parents(".jm-radio-group").find(".hidex").addClass("hide");
		} else {
			$(this).parents(".jm-radio-group").find(".hidex").removeClass("hide");
		}
		$(this).find('.jm-radio').addClass('jm-radio-checked');
		$(this).addClass('jm-cc');
		$(this).find('.jm-radio-input').prop("checked", true);
	});
	
	//重置表单
	$("body").on("click", ".cha-s .cha-reset", function (event){
		event = event || window.event;
		event.stopPropagation();
		resetForm();
		cha();
	});

	//下拉
	$("body").on("click", ".cha-boxx .jm-picker", function (event){
		$("input").removeClass("actives")
		event = event || window.event;
		event.stopPropagation();
		var offset = $(this).offset();
		selectId = $(this).attr('data-id');
		var dom = $("#" + selectId).find(".jm-select-dropdown");
		if(dom.hasClass("jm-select-dropdown-hidden")){
			$(".jm-select-dropdown").addClass('jm-select-dropdown-hidden');
			$(this).find("i").addClass("on");
			dom.removeClass('jm-select-dropdown-hidden')
		} else {
			dom.addClass('jm-select-dropdown-hidden');
			$("#" + selectId + "1").find(".jm-select-dropdown").toggleClass('jm-select-dropdown-hidden');
			dom.addClass('jm-select-dropdown-hidden');
			$(this).find("i").removeClass("on");
		}
		if($(this).find(".jm-picker-label").hasClass("on")){
			$(this).find("input").addClass("actives");
		}
		updateCha();
		dom.css({
			top: offset.top + $(this).height() + 4,
			left: offset.left
		});
	});
	$(".cha-box .jm-picker input").focus(function (event){
		event = event || window.event;
		event.stopPropagation();
		updateCha();
		$(".jm-select-dropdown").addClass('jm-select-dropdown-hidden');
		$(".jm-picker i").removeClass("on");
	});
	$("body").on("mouseenter", ".jm-select-dropdown-menu-item", function (){
		$(this).addClass('on');
	})
	$("body").on("mouseleave", ".jm-select-dropdown-menu-item", function (){
		$(this).removeClass('on');
	})

	//radio与checkbox点击
	$("body").on("click",".jm-checkbox-wrapper",function (event){
		if($(this).find('.jm-checkbox').hasClass('jm-checkbox-disabled')){
			return false;
		}
		if($(this).find('input').is(":checked")){
			$(this).find('.jm-checkbox').addClass('jm-checkbox-checked');
			$(this).find('.jm-checkbox').find("input").prop("checked", true);
			$(this).addClass('jm-cc');
			return;
		}
		$(this).removeClass('jm-cc');
		$(this).find('.jm-checkbox').removeClass('jm-checkbox-checked');
		$(this).find('.jm-checkbox').find("input").prop("checked", false);
	});
	
	//普通下拉选择
	$("body").on("click", ".jm-select-dropdown", function (event){

		event = event || window.event;
		event.stopPropagation();
		var str1 = $("." + selectId).find('.jm-picker-label').next().attr("placeholder");
		var str2 = $.trim($("#" + selectId).find('.on').text());
		if($("#" + selectId).find('.on').length > 0 && selectId != "sfba_1" && selectId != "jzls"){
			$("#" + selectId).find(".jm-select-dropdown").addClass('jm-select-dropdown-hidden');
			if(str1 == str2){
				$("." + selectId).find('.jm-picker-label').text(str2).removeClass("on").attr("title", str2);
			} else {
				$("." + selectId).find('.jm-picker-label').text(str2).addClass("on").attr("title", str2);
			}
			$("#" + selectId).find('li').removeClass('active');
			$("#" + selectId).find('.on').addClass('active');
			$("." + selectId).find('.jm-picker-label').next().attr("data-value", $(this).find('.on').attr("data-value"));
			$(".jm-picker i").removeClass("on");
			formDom.find('input[name=' + $(this).parents('.p-box').attr("data-name") + ']').val($(this).find('.on').attr("data-value")).removeClass("yin");
			if(selectId=="ymjj"){
				var jjms=$(this).find('.on').attr("data-value");
				if(jjms==2){
					$('#chajg .cha-list-box').addClass('jjms_2');
				}else{
					$('#chajg .cha-list-box').removeClass('jjms_2');
				}
				set_c('ykj_jjms',jjms,100);
				tdyc();
			}
			else if(selectId=='ymbhfs' || selectId=='ympcfs'){
				var ms=$(this).find('.on').attr("data-value");
				if(ms>0){
					$('.'+selectId+'_x').addClass('visibilityH');
				}else{
					$('.'+selectId+'_x').removeClass('visibilityH');
				}
			}
		}
		
	});
	
	$(document).click(function (event){
		$(".jm-select-dropdown").addClass('jm-select-dropdown-hidden');
		$("." + selectId).find('i').removeClass("on");
		updateCha();
		$(".jm-picker i").removeClass("on");
		$(".jm-picker input").removeClass("actives");
	});

	$(".jm-ymbh").focus(function (){
		$(".jm-select-dropdown").addClass('jm-select-dropdown-hidden');
		$(".jm-picker i").removeClass("on");
		$(this).addClass("isFocus");
		$(this).parent(".ymbh").addClass("focusOn");
		$(this).parent(".ymbh").next().addClass("focusA");
	}).blur(function (){
		$(this).removeClass("isFocus");
		$(this).parent().removeClass("focusOn");
		$(this).parent().next().removeClass("focusA");
	});

	//域名后缀
	$("body").on("click", ".ymhz li", function (event){
		var ymhzStr = "";
		$(this).parents(".jm-select-dropdown").find(".bx").removeClass('active1');
		$(this).toggleClass('active');
		$(this).parent("ul").find(".active").each(function (k, v){
			ymhzStr += $(v).text() + "/"
		})
		$(this).parents(".jm-select-dropdown").find(".jm-input").val(ymhzStr.substring(0, ymhzStr.lastIndexOf('/')).toLowerCase())
	});
	$("body").on("click", ".ymhz .submit-hz", function (){
		var ymhzStr = $(this).prev().val().toUpperCase();
		if(ymhzStr == ""){
			ymhzStr = "不限";
			$(".cha-list").find("." + selectId).find('.jm-picker-label').text(ymhzStr).removeClass("on").attr("title", ymhzStr);
			formDom.find('input[name="ymhz"]').val('');
		} else {
			formDom.find('input[name="ymhz"]').val(ymhzStr.replace(/\//ig, ',').toLowerCase());
			$(".cha-list").find("." + selectId).find('.jm-picker-label').text(ymhzStr).addClass("on").attr("title", ymhzStr);
			$.each(ymhzStr.toUpperCase().split('/'),function(k,v){
				$('#ymhz .jm-select-dropdown-menu li[data-value="'+v+'"]').addClass('active');
			})
			
		}

		$(".jm-select-dropdown").addClass('jm-select-dropdown-hidden');
		$(".jm-picker i").removeClass("on");
	})
	
	$(".bx").click(function (event){
		$(this).parents(".jm-select-dropdown").find('li').removeClass('active')
		$(this).addClass('active1');
		$(this).parents(".jm-select-dropdown").find(".jm-input").val('');
		$(".cha-list").find("." + selectId).find('.jm-picker-label').text('不限').removeClass("on").attr("title", '');
		formDom.find('input[name="'+selectId+'"]').val('');
	});
	$(".cz").click(function (event){
		var dom=$(this).closest(".jm-select-dropdown");
		dom.find('li').removeClass('active');
		dom.find('input').val('');
	});
	$("#sfba_11 .cz").click(function(){
		$('input[name=baxz],input[name=bajrs]').val('');
	})
	$("#jzls1 .cz").click(function(){
		$('input[name^=jznl],input[name^=jzjl],input[name=jzyy]').val('');
	})
	
	//单选型
	$(".slfl ul li").click(function (event){
		var $id = $(this).parents(".slfl");
		var $txt = $.trim($(this).text());
		var $this = $(this);
		var th2=$this.parents('.p-box').attr("data-name");
		$this.parents(".jm-select-dropdown").find(".bx1").removeClass('active');
		$(".slfl ul li").removeClass("active")
		$this.addClass('active');
		$("#" + selectId).find(".jm-select-dropdown").addClass('jm-select-dropdown-hidden')
		$(".jm-picker i").removeClass("on");
		
		if($txt == "不限"){
			$(".cha-list").find("." + selectId).find('.jm-picker-label').text($this.text()).removeClass("on").attr("title", $txt);
			return false;
		} else {
			$(".cha-list").find("." + selectId).find('.jm-picker-label').text($this.text()).addClass("on").attr("title", $txt);
		}

		if($txt.indexOf('≥')>-1){
			console.log(1111)
			$txt = $txt.slice(1);
			if($(this).attr('data-value')){
				$txt=$(this).attr('data-value');
			}
			$id.find(".integer").eq(0).val($txt);
			$id.find(".integer").eq(1).val("");
			formDom.find('input[name=' + th2 + '_1' + ']').val($txt).removeClass("yin");
			formDom.find('input[name=' + th2 + '_2' + ']').val("").addClass("yin");
		}
		else if($txt.indexOf('≤')>-1){
			$txt = $txt.slice(1);
			if($(this).attr('data-value')){
				$txt=$(this).attr('data-value');
			}
			$id.find(".integer").eq(1).val($txt);
			$id.find(".integer").eq(0).val("");
			formDom.find('input[name='+th2+'_1]').addClass("yin");
			formDom.find('input[name='+th2+'_2]').val($this.attr("data-value")).removeClass("yin");
		}
		
	});
	
	$(".integer").keyup(function (){
		$(this).val($(this).val().replace(/[^0-9]/g,''));
	});
	$(".slfl button").click(function (){
		var slfl = $(this).parents(".slfl");
		var val1 = slfl.find('.integer').eq(0).val();
		var val2 = slfl.find('.integer').eq(1).val();
		var id=slfl.attr("id");
		var that = $(this);
		var str1;
		if(id == "zcsj" || id=='dqsj'){
			formDom.find('input[name='+id+']').addClass("yin");
			slfl.find('.integer').each(function (k, v){
				formDom.find('input[name='+id+'_' + (k + 1) + ']').val($(v).val()).removeClass("yin");
			})
			var dw=id=='zcsj' ? '年' : '天';
			str1 = val1 && val2 ? val1 + dw + "-" + val2 + dw : val1 == "" && val2 != "" ? "≤" + val2 + dw : val2 == "" && val1 != "" ? "≥" + val1 + dw : "不限";
		} 
		else{
			slfl.find('.integer').each(function (k, v){
				formDom.find('input[name='+id+'_' + (k + 1) + ']').val($(v).val()).removeClass("yin");
			})
			str1 = val1 && val2 ? val1 + "-" + val2 : val1 == "" && val2 != "" ? "≤" + val2 : val2 == "" && val1 != "" ? "≥" + val1 : "不限";
		}
		
		$(".jm-select-dropdown").addClass('jm-select-dropdown-hidden');
		$(".jm-picker i").removeClass("on");
		if(str1 == "不限"){
			$(".cha-list").find("." + selectId).find('.jm-picker-label').text(str1).attr("title", str1).removeClass("on");
			return;
		}
		slfl.find("li").removeClass("active");
		$(".cha-list").find("." + selectId).find('.jm-picker-label').text(str1).attr("title", str1).addClass("on");
	})
	$(".bx1").click(function (event){
		$(this).parents(".jm-select-dropdown").find('li').removeClass('active')
		$(this).addClass('active');
		$(this).parents('.slfl').find('input').val('');
		formDom.find('input[name=' + $(this).parents('.p-box').attr("data-name") + "_1" + ']').val('');
		formDom.find('input[name=' + $(this).parents('.p-box').attr("data-name") + "_2" + ']').val('');
	});
	$(".cz1").click(function (event){
		$(this).parents(".jm-select-dropdown").find('li').removeClass('active')
		$(this).addClass('active');
		$(this).parents('.slfl').find('input').val('');
		$(this).parents(".slfl").find("input").eq(0).val(1);
		formDom.find('input[name=' + $(this).parents('.p-box').attr("data-name") + "_1" + ']').val('1');
		formDom.find('input[name=' + $(this).parents('.p-box').attr("data-name") + "_2" + ']').val('');
	});

	//建站记录
	$("#sfba_1 ul li").click(function (event){
		var offsetx = $("." + selectId).offset();
		var val = $(this).attr("data-value");
		formDom.find('input[name=sfba_1]').val(val);
		if($.trim($(this).text()) == '不限'){
			formDom.find('input[name=bajrs]').val('');
			formDom.find('input[name=baxz]').val('');
			$(".cha-list ." + selectId).find('.jm-picker-label').text($(this).text()).attr("title", $(this).text()).removeClass('on');
			$(".jm-select-dropdown").addClass('jm-select-dropdown-hidden');
			$(".jm-picker i").removeClass("on");
			return;
		}
		
		if(val == 99){
			$(".jm-select-dropdown").addClass('jm-select-dropdown-hidden');
			$(".jm-picker i").removeClass("on");
		} else {
			$("#sfba_11").find(".jm-select-dropdown").removeClass('jm-select-dropdown-hidden').css({
				top: offsetx.top + $("." + selectId).height() + 4,
				left: offsetx.left,
				zIndex: 9999
			});
			if(val != 1){
				formDom.find('input[name=bajrs]').val('').addClass("yin");
				$(".jrs").addClass("hide").find("li").removeClass("active")
			} else {
				formDom.find('input[name=bajrs]').removeClass("yin");
				$(".jrs").removeClass("hide");
			}
		}
		$("#sfba_1 ul li").removeClass('active');
		$(this).addClass('active');
		$(".cha-list ." + selectId).find('.jm-picker-label').text($(this).text()).addClass("on").attr("title", $(this).text());
	});
	$(".sfba_11 ul li").click(function (){
		$(this).parents("ul").find('li').removeClass("active")
		$(this).addClass("active");
		formDom.find('input[name=' + $(this).attr("data-name") + ']').val($(this).attr("data-value"));
	})
	$(".sfba_11 .qd").click(function (){
		var inputStr = '';
		var dom1 = $("#sfba_11").find('li.active').eq(0);
		var dom2 = $("#sfba_11").find('li.active').eq(1);
		var str1 = dom1.text();
		var str2 = dom2.text();
		formDom.find('input[name=' + dom1.attr("data-name") + ']').val(dom1.attr("data-value"));
		formDom.find('input[name=' + dom2.attr("data-name") + ']').val(dom2.attr("data-value"));
		if($(".jrs").hasClass("hide")){
			formDom.find('input[name=bajrs]').val('').addClass('yin');
		}
		var val = $.trim($(".cha-list").find("." + selectId).find('.jm-picker-label').text());
		inputStr = str1 && str2 ? val + "-" + str1 + "-" + str2 : str1 == "" ? val : val + "-" + str1;
		$(".cha-list").find("." + selectId).find('.jm-picker-label').text(inputStr).addClass("on").attr("title", inputStr);
		$(".jm-select-dropdown").addClass('jm-select-dropdown-hidden');
		$(".jm-picker i").removeClass("on");
	})
	
	//建站历史
	$("#jzls ul li").click(function (event){
		$(".jm-select-dropdown").addClass('jm-select-dropdown-hidden');
		$(".jm-picker i").removeClass("on");
		if($.trim($(this).text()) == '不限'){
			formDom.find('.jzlsx').val('').addClass('yin');
			$(".cha-list ." + selectId).find('.jm-picker-label').text($(this).text()).attr("title", $(this).text()).removeClass('on');
			return;
		}
		else if($(this).attr("data-value") == 99){//不存在
			formDom.find('.jzlsx').val('').addClass('yin');
		} 
		else {
			var offset = $("." + selectId).offset();
			$("#jzls1").find(".jm-select-dropdown").removeClass('jm-select-dropdown-hidden').css({
				top: offset.top + $("." + selectId).height() + 4,
				left: offset.left,
				zIndex: 9999
			});
		}
		formDom.find('input[name=jzls]').val($(this).attr("data-value")).removeClass('yin');
		$("#jzls ul li").removeClass('active');
		$(this).addClass('active');
		$(".cha-list ." + selectId).find('.jm-picker-label').text($(this).text()).addClass("on").attr("title", $(this).text());
	});
	$("#jzls1 ul li").click(function (){
		$(this).parents("ul").find('li').removeClass("active");
		$(this).addClass("active");
		formDom.find('input[name=' + $(this).attr("data-name") + ']').val($(this).attr("data-value")).removeClass("yin");
	})
	$("#jzls1 .qd").click(function (){
		var inputStr = '';
		var val1 = $(".jzln1").val();
		var val2 = $(".jzln2").val();
		var val3 = $(".jzlsjl1").val();
		var val4 = $(".jzlsjl2").val();
		var val5 = $("#jzls1").find('li.active').text();
		var str1, str2;
		str1 = val1 && val2 ? val1 + "-" + val2 + "年/" : val1 == "" && val2 != "" ? "≤" + val2 + "年/" : val2 == "" && val1 != "" ? "≥" + val1 + "年/" : "";
		str2 = val3 && val4 ? val3 + "-" + val4 + "记录/" : val3 == "" && val4 != "" ? "≤" + val4 + "记录/" : val4 == "" && val3 != "" ? "≥" + val3 + "记录/" : "";
		val5 = !val5 ? "" : val5 + "/";
		inputStr = str1 + val5 + str2;
		inputStr = inputStr == "" ? "存在" : inputStr.substring(0, inputStr.lastIndexOf('/'));
		$("#jzls1 input").each(function (k, v){
			formDom.find('input[name=' + $(v).attr("name") + ']').val($(v).val()).removeClass("yin");
		})
		$(".cha-list").find(".jzls").find('.jm-picker-label').text(inputStr).addClass("on").attr("title", inputStr);
		$(".jm-select-dropdown").addClass('jm-select-dropdown-hidden');
		$(".jm-picker i").removeClass("on");
	})

//表格操作
	//查询列表全选
	$("body").on("click", ".checkAll", function (){
		var dom = $('.cha-list-box .jm-checkbox');//:not(.jm-checkbox-disabled)
		$(".cha-list-box").addClass('x_tarn');
		if(isCheckAll){
			dom.addClass('jm-checkbox-checked');
			$('.cha-list-box .jm-checkbox-wrapper .jm-checkbox input').prop("checked", true);
			isCheckAll = 0;
		} else {
			dom.removeClass('jm-checkbox-checked');
			$('.cha-list-box .jm-checkbox-wrapper .jm-checkbox input').prop("checked", false);
			isCheckAll = 1;
		}
	});

	$("body").on("click", ".notice .close", function (){
		var div=$(this).parent('.notice');
		var name=div.attr('id');
		set_c(name,1,30*24);
		div.hide();
	});

	$("body").on("click", "#ykjtj .close", function (){
		var div=$('#ykjtj');
		set_c('ykjtj',1,12);
		div.hide();
	});

	
});


